# -*- coding: utf-8 -*-
# Author: tom
# time: 2024/3/1 17:26
# description：
import os
from object_model.component_object_model import componentOperate, componentMore, componentUpload, componentSelect, \
    componentList, componentBatchDelete,componentManage,componentPaging
from object_model.login_module import LoginModule
from object_model.logout_module import LogoutModule
from object_model.asset_module import AssetModule, AddBimAsset, AssetList, AssetSearch, AssetMore, AssetGisBim, \
    AssetGisSearch, AssetBimAssembley, AddGisAsset, AssetQuery, AssetGisConfirm, AssetGisList
from object_model.model_module import ModelList, ModelMore, ModelSelect, ModelAssembly, ModelUpload, \
    ModelDelete, ModelConvert, ModelFolder,ModelPreview
from object_model.scene_module import SceneList
from utils.load_yaml import load_yaml_file
from config.setting import FILE_PATH

# 获取每个yaml中的所有元素数据
__object_login_Data = load_yaml_file(os.path.join(FILE_PATH['yaml_data'], 'xbase_login_repository.yaml'))
__object_asset_Data = load_yaml_file(os.path.join(FILE_PATH['yaml_data'], 'xbase_asset_repository.yaml'))
__object_component_Data = load_yaml_file(os.path.join(FILE_PATH['yaml_data'], 'xbase_component_repository.yaml'))
__object_model_Data = load_yaml_file(os.path.join(FILE_PATH['yaml_data'], 'xbase_model_repository.yaml'))
__object_logout_Data=load_yaml_file(os.path.join(FILE_PATH['yaml_data'], 'xbase_logout_repository.yaml'))
__object_scene_Data=load_yaml_file(os.path.join(FILE_PATH['yaml_data'], 'xbase_scene_repository.yaml'))

# 获取loginpage下的所有子元素  # y原先用parse_obj,现在改为model_validate
loginObject = LoginModule.model_validate(__object_login_Data['loginPage'])
# 获取assetpage下所有子元素
assetObject = AssetModule.model_validate(__object_asset_Data['assetPage'])
# 获取添加bim资产模块下所有子元素
addBimAssetObject = AddBimAsset.model_validate(__object_asset_Data['addBimAssetPage'])
# 获取资产列表模块下所有子元素
assetListObject = AssetList.model_validate(__object_asset_Data['assetListPage'])
# 获取资产列表查询搜索下所有子元素
assetSelectObject = AssetSearch.model_validate(__object_asset_Data['assetSelectPage'])
# 获取资产列表更多下拉框下所有子元素
assetMoreObject = AssetMore.model_validate(__object_asset_Data['assetMorePage'])
# 获取gis资产查询设置中下拉框中的所有子元素
assetGisSelectObject = AssetGisSearch.model_validate(__object_asset_Data['assetGisSelectPage'])
# 切换资产管理中的gis和bim资产tab
assetGisBimObject = AssetGisBim.model_validate(__object_asset_Data['assetGisBimPage'])
# bim资产装配相关的所有子元素
AssetBimAssembleyObject = AssetBimAssembley.model_validate(__object_asset_Data['assetAssemblyPage'])
# gis资产列表相关的所有子元素
AssetGisListObject = AssetGisList.model_validate(__object_asset_Data['assetGisListPage'])
# 添加gis资产相关的所有子元素
AddGisAssetObject = AddGisAsset.model_validate(__object_asset_Data['addGisAssetPage'])
AssetGisConfirmObject = AssetGisConfirm.model_validate(__object_asset_Data['assetGisConfirmPage'])
# gis资产查询设置不同选项对应不同查询的所有子元素
AssetQueryObject = AssetQuery.model_validate(__object_asset_Data['AssetQueryPage'])

# 模型管理
modelListObject = ModelList.model_validate(__object_model_Data['modelListPage'])
modelMoreObject = ModelMore.model_validate(__object_model_Data['modeMorePage'])
modelSelectObject = ModelSelect.model_validate(__object_model_Data['modelSelectPage'])
modelAssemblyObject = ModelAssembly.model_validate(__object_model_Data['modelAssemblyPage'])
modelFolderObject = ModelFolder.model_validate(__object_model_Data['modelFolderPage'])
modelUploadObject = ModelUpload.model_validate(__object_model_Data['modelUploadPage'])
modelDeleteObject = ModelDelete.model_validate(__object_model_Data['modelDeletePage'])
modelConvertObject = ModelConvert.model_validate(__object_model_Data['modelConverPage'])
modelPreviewObject= ModelPreview.model_validate(__object_model_Data['modelPreviewPage'])

# 构件管理
# 获取assetpage下所有子元素
componentObject = componentManage.model_validate(__object_component_Data['componentPage'])
# 构件管理-构件列表操作中相关所有子元素
componentOperateObject = componentOperate.model_validate(__object_component_Data['componentOperatePage'])
# 构件管理-构件列表更多中相关子元素，比如：详情、分享等
componentMoreObject = componentMore.model_validate(__object_component_Data['componentMorePage'])
# 构件管理-构件上传相关子元素
componentUploadObject = componentUpload.model_validate(__object_component_Data['componentUploadPage'])
# 构件管理-构件搜索相关子元素
componentSelectObject = componentSelect.model_validate(__object_component_Data['componentSelectPage'])
# 构件管理-构件列表相关子元素，涉及：构件名称、状态
componentListObject = componentList.model_validate(__object_component_Data['componentListPage'])
# 构件管理-构件批量删除相关子元素
componentBatchDeleteObject = componentBatchDelete.model_validate(__object_component_Data['componentBatchDeletePage'])
# 构件管理-分页操作相关子元素
componentPagingPageObject = componentPaging.model_validate(__object_component_Data['componentPagingPage'])

# 场景管理
sceneListObject=SceneList.model_validate(__object_scene_Data['sceneListPage'])

# 退出
logoutObject=LogoutModule.model_validate(__object_logout_Data['logoutPage'])